package cn.ppdai.hu.firstBoot;


import com.neo.entity.UserEntity;
import com.neo.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.io.UnsupportedEncodingException;

/**
 * Created by huxuhong on 2018/9/6.
 */
@RestController
public class TestController {

    @Autowired
    private BaseProperties baseProperties;

    @Autowired
    private UserMapper userMapper;

    @RequestMapping("/getUser")
    public String getUser(@RequestParam String name){
        System.out.println("这个是我新增加的来啦啦啦啦");
        String name_1 = null;
        try {
            name_1 = new String(baseProperties.getName().getBytes("iso-8859-1"),"utf-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        String age_1  = baseProperties.getId();
        System.out.println("name_1"+name_1+"age_1"+age_1);
        return  name+"Hello world";
    }


    @RequestMapping("/testMybatis")
    public String testMybatis(){

        UserEntity ue = userMapper.getOne(1L);
        return ue.getNickName();
    }

}
